package hui.zhang.service.transit.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import hui.zhang.dao.transit.DeliveryInfoRepository;
import hui.zhang.dao.transit.TransitInfoRepository;
import hui.zhang.domain.transit.DeliveryInfo;
import hui.zhang.domain.transit.TransitInfo;
import hui.zhang.service.transit.DeliveryInfoService;

@Service
@Transactional
public class DeliveryInfoServiceImpl implements DeliveryInfoService {

	@Autowired
	private DeliveryInfoRepository deliveryInfoRepository;
	@Autowired
	private TransitInfoRepository transitInfoRepository;

	@Override
	public void save(DeliveryInfo model, String transitInfoId) {
		deliveryInfoRepository.save(model);
		
		// 查询运输配送信息
		TransitInfo transitInfo = transitInfoRepository
				.findOne(Integer.parseInt(transitInfoId));
		transitInfo.setDeliveryInfo(model);
		transitInfo.setStatus("开始配送");
	}
	
	
}
